
/* 
 * File:   newmain.cpp
 * Author: saulio
 *
 * Created on June 30, 2012, 10:52 PM
 */

#include <iostream>
#include <fstream>
using namespace std;
int main() 
{
 int n=0,s=0,cont=0,m=0;
 bool r=false,l=false,i=true,pop=false,romi=false;
 char cadena[1024]={0},ip[30]={0},port[30]={0},seq[30]={0};
// Crea un fichero de salida
  ifstream fs("client.txt");
// parte de la cadena:

fs.getline(cadena, 1024);

while (i) 
{ 
  
  if(cadena[n]=='>'){
      s=0;
      n++;
      while(cadena[n]!=':'){
          n++;
          ip[s]=cadena[n];
          s++; 
      }
  }
  if(cadena[n]=='q'){
      s=0;
      n++;
      while(cadena[n]!=','){
          n++;
          seq[s]=cadena[n];
          s++; 
          i=false;
      }
  }
}
      
for(n=0;n<=sizeof(ip);n++)
{
    if(ip[n]=='.'){ 
      cont++;
      if(cont==4){
          s=0;
          n++;
          while(cadena[n]!=','){
               n++;
               seq[s]=cadena[n];
               s++;
           }
      }
    }
}



cout <<ip<< endl;
cout<<port<<endl;
cout<<seq<<endl;
cin.get();
return 0;



}